|
|
|
|
|
|
|
If this all sounds difficult, it isand you haven't even considered what the layout of the dialog box will like yet. And remember that this is just one dialog-box interface. The Common Dialog control, on the other hand, has six different functions that you can use. |
|
|
|
|
|
|
|
|
Of course, if you use the System File controls included in Visual Basic to create the Open dialog box, the process would be easier, but the resulting interface would look more like the old Windows 3.1 interface than a current Windows display (see Figure 2.1). |
|
|
|
|
|
|
|
|
Figure 2.1.
A custom Open Dialog that
uses the included System File
controls in Visual Basic. |
|
|
|
|
|
|
|
|
As you can see, the best way to put these functions in your application is to use the Common Dialog control. Although the simple setup is a benefit to you as a programmer, an even bigger bonus is that these dialog boxes are familiar to anyone who has used Windows 95 for more than a day, because they're the exact same dialog boxes that Windows 95 uses. |
|
|
|
|
|
|
|
|
Interfacing with the Common Dialog |
|
|
|
|
|
|
|
|
The actual common dialog routines are distributed in a dynamic link library file called COMDLG32.DLL. The way in which you, as the developer, interact with this library is by using the Common Dialog control. Although this control is used in almost every application that you may create, it's not one of the default controls displayed in the Visual Basic toolbox. |
|
|
|
|
|
|
|
|
As a review, the Common Dialog control can access five standard Windows dialog boxes and one function: |
|
|
|
|
|
|
|
|
Open/Save As allows users to select files to open or choose filenames to save. |
|
|
|
|
|
|
|
|
Font lets users choose a base font and set any font attributes they want. |
|
|
|
|
|
|
|
|
Color allows users to choose from a standard color or create a custom color for |
|
|
|
|
|